<template>
	<!-- S 扫码交易 -->
	<view>
		<uni-nav-bar backgroundColor="transparent" :statusBar="true" :border="false" :fixed="true" color="#fff"
			left-icon="back" @clickLeft="$tab.back()" title="商家收款码">
		</uni-nav-bar>

		<view class="box-1">

		</view>

		<view class="box-2" v-if="user && storeDetail">
			<image :src="user.avatar" class="image-1 round" mode=""></image>

			<view class="text-32 text-center">
				店铺名称：{{ name || storeDetail.name}}
			</view>

			<view class="box-3 flex items-center justify-around">
				<image :src="`data:image/jpg;base64,${base}`" class="image-2" mode=""></image>
			</view>

			<view class="box-4 text-center text-32">
				商家收款码
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: this.$store.getters.userInfo,
				storeDetail: null,
				base: "",
				name:""
			};
		},
		onLoad(e) {
			if(e && e.name){
				this.name = e.name
			}
			
			this.base = uni.getStorageSync('code')
			
			this.$Api.store.appgetstores().then((res) => {
				this.storeDetail = res.data
			})
		},
		methods: {
			scanTran() {
				uni.scanCode({
					autoZoom: false,
					success: (res) => {
						this.$tab.nav(`/pages/scaned/commercial?phone=${res.result}`)
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	/deep/ .uni-navbar {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		z-index: 9;
	}

	.box-1 {
		height: 436rpx;
		background: linear-gradient(180deg, #FF561D 73%, #F8F8F8 100%);
	}

	.box-2 {
		width: 710rpx;
		background: #FFFFFF;
		box-shadow: 0px 0px 20rpx 0px rgba(153, 153, 153, 0.16);
		border-radius: 16rpx;
		position: relative;
		left: 20rpx;
		top: -118rpx;
		padding: 112rpx 55rpx 56rpx;

		.image-1 {
			width: 160rpx;
			height: 160rpx;
			position: absolute;
			left: calc(50% - 80rpx);
			top: -80rpx;
		}

		.box-3 {
			width: 600rpx;
			height: 600rpx;
			background: url('https://file.fulewanjia.com/fulewanjia/profile/appImages/store/erweimakuang@2x.png');
			background-size: 100% 100%;
			margin-top: 68rpx;

			.image-2 {
				width: 480rpx;
				height: 480rpx;
			}
		}

		.box-4 {
			width: 354rpx;
			height: 64rpx;
			background: #FFF8EC;
			border-radius: 8rpx;
			margin: 72rpx auto 0;
			color: #9E9E9E;
			line-height: 64rpx;
		}
	}

	.box-5 {
		width: 600rpx;
		height: 88rpx;
		background: #F40900;
		border-radius: 12rpx;
		margin: 0rpx auto 0;

		.image-3 {
			width: 36rpx;
			height: 36rpx;
		}
	}
</style>